package com.mesd.killer.model;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.Proxy;

@Entity(name="gameResult")
@Table(name="game_result")
@Cache(usage=CacheConcurrencyStrategy.READ_ONLY)
@Proxy(lazy=false)
public class GameResult implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6173441883860468384L;

	public static final String TABLE_GAME_RESULT = "gameResult";
	
	@Id
	@Column(name="game_id")
	private Long gameId;
	public final static String GAME_ID = "gameId";
	
	@Column(name="round")
	private String round;
	public final static String ROUND = "round";
	
	@Column(name="league_name",length=50)
	private String leagueName;
	public final static String LEAGUE_NAME = "leagueName";
	
	@Column(name="game_time",columnDefinition="datetime")
	private Timestamp gameTime;
	public final static String GAME_TIME = "gameTime";
	
	@Column(name="host_team",length=50)
	private String hostTeam;
	public final static String HOST_TEAM = "hostTeam";
	
	@Column(name="visit_team",length=50)
	private String visitTeam;
	public final static String VISIT_TRAM = "visitTeam";
	
	@Column(name="pankou_result",length=10)
	private String pankouResult;
	public final static String PANKOU_RESULT = "pankouResult";
	
	@Column(name="daxiao_result",length=10)
	private String daxiaoResult;
	public final static String DAXIAO_RESULT = "daxiaoResult";
	
	@Column(name="half_score",length=10)
	private String halfScore;
	public final static String HALF_SCORE = "halfScore";
	
	@Column(name="full_score",length=10)
	private String fullScore;
	public final static String FULL_SCORE = "fullScore";
	
	@Column(name="state")
	private int state;
	public final static String STATE = "state";
	
	@Column(name="uda0",length=50)
	private String uda0;
	public final static String UDA0 = "uda0";
	
	@Column(name="uda1",length=50)
	private String uda1;
	public final static String UDA1 = "uda1";
	
	@Column(name="uda2",length=50)
	private String uda2;
	public final static String UDA2 = "uda2";
	
	@Column(name="udt0",columnDefinition="datetime")
	private Timestamp udt0;
	public final static String UDT0 = "udt0";
	
	@Column(name="udt1",columnDefinition="datetime")
	private Timestamp udt1;
	public final static String UDT1 = "udt1";
	
	@Column(name="udt2",columnDefinition="datetime")
	private Timestamp udt2;
	public final static String UDT2 = "udt2";
	
	@OneToMany(targetEntity=GameDetail.class,cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name="game_id",updatable=false)
	private Set<GameDetail> gameDetails = new HashSet<GameDetail>();

	public Long getGameId() {
		return gameId;
	}

	public void setGameId(Long gameId) {
		this.gameId = gameId;
	}

	public String getLeagueName() {
		return leagueName;
	}

	public void setLeagueName(String leagueName) {
		this.leagueName = leagueName;
	}

	public Timestamp getGameTime() {
		return gameTime;
	}

	public void setGameTime(Timestamp gameTime) {
		this.gameTime = gameTime;
	}

	public String getHostTeam() {
		return hostTeam;
	}

	public void setHostTeam(String hostTeam) {
		this.hostTeam = hostTeam;
	}

	public String getVisitTeam() {
		return visitTeam;
	}

	public void setVisitTeam(String visitTeam) {
		this.visitTeam = visitTeam;
	}

	public String getPankouResult() {
		return pankouResult;
	}

	public void setPankouResult(String pankouResult) {
		this.pankouResult = pankouResult;
	}

	public String getDaxiaoResult() {
		return daxiaoResult;
	}

	public void setDaxiaoResult(String daxiaoResult) {
		this.daxiaoResult = daxiaoResult;
	}

	public String getHalfScore() {
		return halfScore;
	}

	public void setHalfScore(String halfScore) {
		this.halfScore = halfScore;
	}

	public String getFullScore() {
		return fullScore;
	}

	public void setFullScore(String fullScore) {
		this.fullScore = fullScore;
	}

	public String getUda0() {
		return uda0;
	}

	public void setUda0(String uda0) {
		this.uda0 = uda0;
	}

	public String getUda1() {
		return uda1;
	}

	public void setUda1(String uda1) {
		this.uda1 = uda1;
	}

	public String getUda2() {
		return uda2;
	}

	public void setUda2(String uda2) {
		this.uda2 = uda2;
	}

	public Timestamp getUdt0() {
		return udt0;
	}

	public void setUdt0(Timestamp udt0) {
		this.udt0 = udt0;
	}

	public Timestamp getUdt1() {
		return udt1;
	}

	public void setUdt1(Timestamp udt1) {
		this.udt1 = udt1;
	}

	public Timestamp getUdt2() {
		return udt2;
	}

	public void setUdt2(Timestamp udt2) {
		this.udt2 = udt2;
	}

	public Set<GameDetail> getGameDetails() {
		return gameDetails;
	}

	public void setGameDetails(Set<GameDetail> gameDetails) {
		this.gameDetails = gameDetails;
	}

	public String getRound() {
		return round;
	}

	public void setRound(String round) {
		this.round = round;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}
	
	@Override
	public boolean equals(Object result)
	{
		long gameId = ((GameResult)result).getGameId();
		boolean flag = gameId == this.getGameId();
		return flag;
	}
}
